<div class="input-group-append">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" tabindex="-1">选择图片</button>
    <div class="dropdown-menu">
        <a class="dropdown-item" href="<!--{iCMS:route url='FilesUser:add' callback='$field'}-->" data-toggle="modal" data-meta='{"width":"300px","height":"80px"}' title="本地上传">
            <i class="fa fa-fw fa-upload"></i>
            本地上传
        </a>
        <!--{if $multi}-->
        <a class="dropdown-item" href="<!--{iCMS:route url='FilesUser:multi' callback='$field'}-->" data-toggle="modal" title="多图上传">
            <i class="fa fa-fw fa-upload"></i>
            多图上传
        </a>
        <!--{/if}-->

        <a class="dropdown-item" href="<!--{iCMS:route url='FilesUser:browse' callback='$field'}-->" data-toggle="modal" title="从网站选择">
            <i class="fa fa-fw fa-search"></i>
            从网站选择
        </a>
        <div class="dropdown-divider"></div>
        <a data-preview="<!--{$field}-->" class="dropdown-item" href="<!--{iCMS:route url='FilesUser:preview' callback='$field'}-->" data-toggle="modal" data-check="1" title="预览">
            <i class="fa fa-fw fa-eye"></i>
            预览
        </a>
    </div>
    <!--{if $multi}-->
    <link rel="stylesheet" href="./assets/oneui/js/plugins/magnific-popup/magnific-popup.css">   
    <script src="./assets/oneui/js/plugins/magnific-popup/jquery.magnific-popup.min.js"></script>
    <script>jQuery(function(){One.helpers('magnific-popup');});</script>
    <script id="multiTpl-multi_image" type="text/html">
        <div class="col-md-6 col-lg-4 col-xl-3">
            <a href="javascript:;" class="delete"><i class="fa fa-times"></i></a>
            <a class="img-link img-link-simple img-link-zoom-in img-lightbox" href="<%data.url%>" target="_blank">
                <img src="<%data.url%>" class="img-thumbnail">
            </a>
            <input type="hidden" name="@a@[]" value="<%data.value%>">
        </div>
    </script>
    <script id="multiTpl-multi_file" type="text/html">
        <div class="col-12 mt-1">
            <div class="input-group input-group-sm">
                <div class="input-group-prepend">
                    <a href="javascript:;" class="btn btn-alt-primary delete"><i class="fa fa-times"></i></a>
                    <input type="hidden" name="@a@[]" value="<%data.value%>">
                </div>
                <input class="form-control" readonly type="text" value="<%data.url%>">
            </div>
        </div>
    </script>
    <!--{/if}-->
    <script src="<!--{$site.urls.assets}-->/class.js"></script>
    <script>
        $(function() {
            var a = new files.picbtn({
                id: "<!--{$field}-->",
                template: "multiTpl-multi_image",
                title: "上传图片",
                is_multi: <!--{$multi?1:0}-->,
                is_http: false,
                vdata: {'<!--{$field}-->_http': 1},
                data: {'src':'<!--{$value}-->'}
            });
            window.modal_<!--{$field}--> = function(json,flag){
                if (json.state == 'SUCCESS') {
                    return a.modal(null,json,flag);
                } else {
                    return iCMS.ui.alert(json.message);
                }
            }
        });
        </script>
</div>
